#include "stdafx.h"
#include "memorygame.h"
#include "admindialog.h"
#include <QtGui/QApplication>
#include "gamewizard.h"
#include "gamecreator.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    if (argc == 3 && strcmp( argv[ 1 ], "edit" ) == 0)
    {
        AdminDialog * adminDialog = new AdminDialog( NULL );
        adminDialog->show();
    }
    else
    {
        GameWizard * gameWizard = new GameWizard;
        if (gameWizard->exec() != QDialog::Accepted)
            return false;
        
        int topicCategory, topicCount, playersCount;
        QVector<int> questionValues;
        gameWizard->data( topicCategory, topicCount, questionValues, playersCount );
        GameCreator gameCreator( topicCategory, topicCount, questionValues );
        if (! gameCreator.createGame())
            return false;

        MemoryGame * w = new MemoryGame( gameCreator.topicVector(), questionValues, playersCount );
        w->show();
    }

    return a.exec();
}
